var attendantCtrl = avalon.define({
    $id: "attendant",
    staffId: "",
    cloudGuideId: "",
    serviceNumId: "",
    msgContent : "",
    fedit: false,
    cedit: function(){
        attendantCtrl.fedit = true;
    },
    cupdate: function(){
        $.ajax({
            type: "get",
            url: DI.asetupSsistant,
            data: {
            	staffId: attendantCtrl.staffId,
            },
            dataType: "json",
            success: function(data){
            	if(!data){
            		throw '错误';
            	}else if(data.retFlag==='1'){
        			attendantCtrl.staffId = data.assistant.staffId;
            		attendantCtrl.cloudGuideId = data.assistant.cloudGuideId;
            		PLATFORM.headTip("操作成功", "#53CC2D");
        		}else if(data.retFlag==='0'){
        			PLATFORM.headTip(data.errorMessage);
        		}
            }
        });
    },
    sendMsg : function(){
    	$.ajax({
    		type: "post",
            url: DI.groupSendMsg,
            data: {
            	serviceNumId : attendantCtrl.serviceNumId,
            	msgContent : attendantCtrl.msgContent
            },
            dataType: "json",
            success: function(data){
            	if(!data){
            		throw '错误';
            	}else if(data.retFlag==='1'){
            		PLATFORM.headTip("收到请求，正在奋力发送", "#53CC2D");
        		}else if(data.retFlag==='0'){
        			PLATFORM.headTip(data.errorMessage);
        		}
            }
    	});
    },
    init: function(){
        $.ajax({
            type: "get",
            url: DI.queryAssistant,
            data: {
            },
            dataType: "json",
            success: function(data){
            	if(!data){
            		throw '错误';
            	}else if(data.retFlag==='1'){
        			attendantCtrl.staffId = data.assistant.staffId;
            		attendantCtrl.cloudGuideId = data.assistant.cloudGuideId;
        		}else if(data.retFlag==='0'){
        			PLATFORM.headTip(data.errorMessage);
        		}
            }
        });
    }
});
attendantCtrl.init();
avalon.scan();


